var express = require("express")
var router = express.Router();

//get请求
router.get("/",(req,res)=>{
   console.log("查询操作");
   res.json({"msg":"查询操作"});
});

//:stuid //rest 采用路径参数 用冒号+参数名  比如：studeng/:stuid
router.delete("/:studentId/:name",(req,res)=>{
    console.log("删除操作");
    //rest的动态参数 是 
    let {studentId,name}= req.params;
    console.log("删除的id==>",studentId,name)
   res.json({"msg":"删除操作"});
})


router.post("/",(req,res)=>{
    console.log("添加操作");
    console.log(req.body);
    let {name,gender,age,classid}=req.body;
    console.log(name,gender,age,classid);
   res.json({"msg":"添加操作"});
});


router.put("/",(req,res)=>{
    console.log("修改操作");
   res.json({"msg":"修改操作"});
});

module.exports=router;